Skip to content

Add current password verification endpoint#22

Merged
sidhujag merged 4 commits intomainfrom
fix/auth-verify-password-endpoint
Apr 25, 2026
Merged

Add current password verification endpoint#22
sidhujag merged 4 commits intomainfrom
fix/auth-verify-password-endpoint

Conversation

@sidhujag
Copy link
Copy Markdown
Member

Summary

  • Adds POST /auth/verify-password as a read-only authenticated credential check.
  • Requires CSRF and validates the submitted auth hash without rotating sessions or changing credentials.
  • Adds route coverage for success, mismatch, malformed body, unauthenticated, and missing-CSRF cases.

Test plan

  • npm test -- tests/auth.routes.test.js

Made with Cursor

Add a read-only credential check so client-side vault setup can verify the current account password before persisting encrypted data.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7df68f6550

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread routes/auth.js
Comment on lines +927 to +930
'/verify-password',
sessionMw.requireAuth,
csrfMw.require,
(req, res) => {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add rate limiting to verify-password endpoint

POST /auth/verify-password is wired with only requireAuth and CSRF checks, so it exposes an unthrottled 401/204 credential oracle (verifyPasswordStepUp) for any actor who obtains a live session+CSRF token (for example via session theft or XSS). Unlike /auth/change-password, successful guesses here have no user-visible side effect (no password rotation email/session churn), which makes password discovery significantly stealthier and easier to automate; this endpoint should use a limiter (ideally per user/session) similar to other auth-sensitive probes.

Useful? React with 👍 / 👎.

Throttle current-password verification with a session-scoped bucket so abuse of one stolen session cannot block other active sessions for the same user.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7883fc7482

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread routes/auth.js Outdated
'/verify-password',
sessionMw.requireAuth,
csrfMw.require,
limiters.verifyPassword,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Guard missing verifyPassword limiter before route registration

createAuthRouter now always injects limiters.verifyPassword into POST /auth/verify-password, but this commit did not make the new key optional. Any caller still passing the previous limiter shape (for example the existing builders in tests/govProposals.routes.test.js that omit verifyPassword) will pass undefined as middleware and fail router construction at startup. This is a backward-incompatible crash path introduced by this change; add a safe default (e.g., disabled limiter) or update all call sites that construct limiters manually.

Useful? React with 👍 / 👎.

Update direct auth-router test mounts so the new verify-password middleware is present in full-suite CI.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Avoid direct auth-router mount crashes when older test or integration harnesses omit the new verify-password limiter key.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sidhujag sidhujag merged commit a34e700 into main Apr 25, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant